#include <iostream>
#include "dogservice.h"
#include "loghelper.h"

using namespace RockLog;

static void updateExpireDateStatusCallBack(int status)
{
    LOG(kDebug) << "The superdog expire date status: " << status << std::endl;
    if (status != 0)
    {
        LOG(kErr) << "The superdog have arrived expire date! Status: " << status << std::endl;
    }
};

static void updateSessionStatusCallBack(int status)
{
    LOG(kDebug) << "dog status: " << status << std::endl;
    if (status != 0)
    {
        LOG(kErr) << "dog status error! status: " << status << std::endl;
    }
};

int main(int argc, char *argv[])
{
    DogService dogService;
    dogService.setTimerInterval(3, 30);
    dogService.start();
    dogService.checkDogExpireDate(updateExpireDateStatusCallBack);
    dogService.checkDogStatus(updateSessionStatusCallBack);
    LOG(kDebug) << "getMemoryInfo: " << dogService.getMemoryInfo() << std::endl;
    LOG(kDebug) << "getDogExpireDateStatus: " << dogService.getDogExpireDateStatus() << std::endl;
    LOG(kDebug) << "getCheckExpDateFlag: " << dogService.getCheckExpDateFlag() << std::endl;
    LOG(kDebug) << "getDogStatus: " << dogService.getDogStatus() << std::endl;

    getchar();
    dogService.stop();
    return 0;
}
